$(document).ready(function () {
	$("#commentForm").validate({
        rules: {
        	"zhujieren_area":{
        		 required: true
        	},
        	"zhujieren_tel1":{
        		required: true,
        		mobile: true
        	},
        	"zhujieren_postcode":{
        		youzCode:true,
        	},
        	"zhujieren_tel1Area":{
        		required: true
        	},
        	"zhujieren_monthIncome":{
        		allMoney: true
        	},
        	"zhujieren_tel2":{
        		mobile: true
        	},
        	"zhujieren_nowTel":{
        		telPhone: true
        	},
        	"zhujieren_familyTel":{
        		telPhone: true
        	},
        	"zhujieren_nowAddr":{
        		required: true
        	},
        	"zhujieren_familyAddr":{
        		required: true
        	},
        	"zhujieren_contact1":{
        		required: true
        	},
        	"zhujieren_contact1Tel1":{
        		required: true,
        		telPhone: true
        	},
        	"zhujieren_contact1Tel2":{
        		telPhone: true
        	},
        	"zhujieren_contact2Tel1":{
        		telPhone: true
        	},
        	"zhujieren_contact1Relation":{
        		required: true
        	},
        	"zhujieren_contact2Tel2":{
        		telPhone: true
        	},
        	"zhujieren_companyTel":{
        		telPhone:true
        	},
        },
        messages: {
        	"zhujieren_area":{
        		required: "身份证归属地必填"
        	},
        	"zhujieren_tel1":{
        		required: "手机号码必填",
        		mobile: "错误的手机号码"
        	},
        	"zhujieren_tel1Area":{
        		required: "手机归属地必填"
        	},
        	"zhujieren_tel2":{
        		mobile: "错误的手机号码"
        	},
        	"zhujieren_nowAddr":{
        		required: "现住地址必填"
        	},
        	"zhujieren_familyAddr":{
        		required: "家庭地址必填"
        	},
        	"zhujieren_contact1":{
        		required: "联络人必填"
        	},
        	"zhujieren_contact1Tel1":{
        		required: "联络电话必填",
        		mobile: "错误的号码"
        	},
        	"zhujieren_contact1Tel2":{
        		mobile: "错误的号码"
        	},
        	"zhujieren_contact1Relation":{
        		required: "关系必填"
        	},
        	"zhujieren_contact2Tel1":{
        		mobile: "错误的号码"
        	},
        	"zhujieren_contact2Tel2":{
        		mobile: "错误的号码"
        	},
        	"zhujieren_companyTel":{
        		telPhone:"号码格式错误"
        	}
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	//验证共同购车人
	
	$("#commentFormb").validate({
        rules: {
        	"peiou_idno":{
        		 isIdCardNo: true
        	},
        	"peiou_age":{
        		oldAge: true
        	},
        	"peiou_tel1":{
        		mobile: true
        	},
        	"peiou_companyTel":{
        		telPhone: true
        	},
        	"peiou_monthIncome":{
        		allMoney: true
        	}
        },
        messages: {
        	"isIdCardNo":{
        		required: "身份证号码错误"
        	},
        	"peiou_age":{
        		oldAge: "年龄错误"
        	},
        	"peiou_tel1":{
        		mobile: "号码错误"
        	},
        	"peiou_companyTel":{
        		telPhone: "错误的电话号码"
        	},
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
//验证车辆&车贷
	
	$("#commentFormc").validate({
        rules: {
        	seatNum:{
        		 min: 0,
        		 max:50
        	},
        	price:{
        		allMoney:true,
        		min:1
        	},
        	startYear:{
        		min: 1990,
       		 	max:3000,
       		 zhengZS:true
        	},
        	startMonth:{
        		min: 1,
       		 	max:12,
       		 zhengZS:true
        	},
        	mileage:{
        		min: 0
        	},
        	carAge:{
        		min: 0
        	}
        },
        messages: {
        	seatNum:{
        		 min: "最小1个座位",
        		 max:"最大50个座位"
        	},
        	price:{
        		min:"请输入不能小于0的值"
        	},
        	startYear:{
        		min: "不能小于1900年",
       		    max:"不能大于3000年",
       		 zhengZS:"年有误"
        	},
        	startMonth:{
        		min: "不能小于1",
       		    max:"不能大于12",
       		 zhengZS:"月有误"
        	},
        	carEstimatePrice:{
        		allMoney:"金额有误"
        	},
        	mileage:{
        		min: "不能小于0"
        	},
        	carAge:{
        		min: "不能小于0"
        	},
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	$("#commentFormd").validate({
        rules: {
        	carAge:{
        		min:0
        	},
        	carEstimatePrice:{
        		min:1
        	},
        	bankRate:{
        		min:0
        	},
         	carEstimatePrice:{
        		allMoney:true
        	},
        	loanAmount:{
        		min:0
        	},
        	carPrice:{
        		allMoney:true
        	},
        	loanAmount:{
        		allMoney:true
        	},
        	ccol2:{
        		floatmoney:true
        	}
        },
        messages: {
        	carAge:{
        		min:"不能小于0"
        	},
        	carEstimatePrice:{
        		min:"请输入不能小于0的值"
        	},
        	bankRate:{
        		min:"不能小于0"
        	},
        	loanAmount:{
        		min:"不能小于0"
        	},
        	carPrice:{
        		allMoney:"金额有误"
        	},
        	loanAmount:{
        		allMoney:"金额有误"
        	},
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	$("#commentForme").validate({
        rules: {
        	"danbaoren1_postcode":{
        		youzCode:true
        	},
        	"danbaoren1_nowTel":{
        		telPhone:true
        	},
        	"danbaoren1_familyTel":{
        		telPhone:true
        	},
        	"danbaoren1_contact1Tel1":{
        		telPhone:true
        	},
        	"danbaoren1_contact1Tel2":{
        		telPhone:true
        	},
        	"danbaoren1_contact2Tel1":{
        		telPhone:true
        	},
        	"danbaoren1_contact2Tel2":{
        		telPhone:true
        	},
        	"danbaoren1_tel1":{
        		mobile:true
        	},
        	"danbaoren1_tel2":{
        		mobile:true
        	},
        	"danbaoren1_monthIncome":{
        		allMoney:true
        	},
        	"danbaoren1_companyTel":{
        		telPhone:true
        	},
        },
        
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	$("#commentFormf").validate({
		rules: {
        	"danbaoren2_postcode":{
        		youzCode:true
        	},
        	"danbaoren2_nowTel":{
        		telPhone:true
        	},
        	"danbaoren2_familyTel":{
        		telPhone:true
        	},
        	"danbaoren2_contact1Tel1":{
        		telPhone:true
        	},
        	"danbaoren2_contact1Tel2":{
        		telPhone:true
        	},
        	"danbaoren2_contact2Tel1":{
        		telPhone:true
        	},
        	"danbaoren2_contact2Tel2":{
        		telPhone:true
        	},
        	"danbaoren2_tel1":{
        		mobile:true
        	},
        	"danbaoren2_tel2":{
        		mobile:true
        	},
        	"danbaoren2_monthIncome":{
        		allMoney:true
        	},
        	"danbaoren2_companyTel":{
        		telPhone:true
        	}
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	$("#commentFormg").validate({
		rules: {
        	"danbaoren3_postcode":{
        		youzCode:true
        	},
        	"danbaoren3_nowTel":{
        		telPhone:true
        	},
        	"danbaoren3_familyTel":{
        		telPhone:true
        	},
        	"danbaoren3_contact1Tel1":{
        		telPhone:true
        	},
        	"danbaoren3_contact1Tel2":{
        		telPhone:true
        	},
        	"danbaoren3_contact2Tel1":{
        		telPhone:true
        	},
        	"danbaoren3_contact2Tel2":{
        		telPhone:true
        	},
        	"danbaoren3_tel1":{
        		mobile:true
        	},
        	"danbaoren3_tel2":{
        		mobile:true
        	},
        	"danbaoren3_monthIncome":{
        		allMoney:true
        	},
        	"danbaoren3_companyTel":{
        		telPhone:true
        	}
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	$("#commentFormh").validate({
		rules: {
        	"danbaoren4_postcode":{
        		youzCode:true
        	},
        	"danbaoren4_nowTel":{
        		telPhone:true
        	},
        	"danbaoren4_familyTel":{
        		telPhone:true
        	},
        	"danbaoren4_contact1Tel1":{
        		telPhone:true
        	},
        	"danbaoren4_contact1Tel2":{
        		telPhone:true
        	},
        	"danbaoren4_contact2Tel1":{
        		telPhone:true
        	},
        	"danbaoren4_contact2Tel2":{
        		telPhone:true
        	},
        	"danbaoren4_tel1":{
        		mobile:true
        	},
        	"danbaoren4_tel2":{
        		mobile:true
        	},
        	"danbaoren4_monthIncome":{
        		allMoney:true
        	},
        	"danbaoren4_companyTel":{
        		telPhone:true
        	}
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
	$("#commentFormGPS").validate({
		rules: {
			valueExtras:{
				zhengZS:true,
				max:10
        	}
        },
        messages: {
			valueExtras:{
				zhengZS:'请输入一个整数',
				max:'请输入一个不大于10的数字'
        	}
        },
        //重写showErrors
        showErrors: function (errorMap, errorList) {
            $.each(errorList, function (i, v) {
            	 layer.tips(v.message, v.element, { time: 1500 });
                 
                return false;
            });  
        },
        /* 失去焦点时验证 */
        onfocusout: function(element) {$(element).valid(); },
        /*  键盘抬起不验证 */
        onkeyup:false,
    });
	
});